<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserController
 *
 * @author Loug S
 */
class UserController extends Controller {
   
    /**
    * Connexion
    */
    public function login() {
        if(isset($this->params['user']) && $this->params['pass']){
           
            
            
        }
        
    }
    /**
    * Déconnexion
    */
    public function logout() {}
    
    /**
    * Enregistrement
    */
    public function register() {
       $options = Route::recognizeURL($_GET['url']);
       if(count($options)>2) {
           $donnee=array('login' =>$options['login'], 
                         'email' =>$options['email'],
                         'password' =>$option['password']
               );
           //dans le cas ou j'ai plus de 3 param dans mon adresse
           $this->db=new User($donnee) ;
           $this->db->save() ;
       }else {
           $template="formulaire" ;
           //require_once("../vues/formulaire.tpl");
           $contents=file_get_contents('vues/formulaire.tpl', true);
           echo "$contents" ;
           //$this->render("",$template) ;
       }
       /*if(isset($this->params['user'])) {
           echo "$this->params['user']" ;
            echo "$this->params['login']" ;
             echo "$this->params['pwd']" ;
       }*/
        echo "yeyyeyeyey" ;
           print_r($this->params) ;
           //print_r($options) ;
        
    }
        
    /**
    * Affichage du profil du membre
    */
    public function profil() {}
    
    
    
    
    
    public function render($base = null, $template = null) {
        require_once("./vues/View.php") ;
        $this->view = new View();
        if ($template == null) {
            $template = $this->params['controller'] . '/' . $params['action'];
        }
        $this->view->render($this->data, $this->params, $base, $template);
    }
}

?>
